<?php
global $post_id;

// `get extra meta content
$rate_up = get_post_meta($post_id, 'rate-up', true);
if ($rate_up == '') {
	add_post_meta($post_id, 'rate-up', 0, true);
	$rate_up = 0;
} else {
	$rate_up = (int) $rate_up;
}
$rate_down = get_post_meta($post_id, 'rate-down', true);
if ($rate_down == '') {
	add_post_meta($post_id, 'rate-down', 0, true);
	$rate_down = 0;
} else {
	$rate_down = (int) $rate_down;
}

$views = get_post_meta($post_id, 'views', true);
if ($views == '') {
	add_post_meta($post_id, 'views', 0, true);
	$views = 0;
} else {
	$views = (int) $views;
	//$views++;
	//update_post_meta($post_id, 'views', $views);
}

$previews = get_post_meta($post_id, 'previews', true);
if ($previews!= '') {
	$previews = (int) $previews;
} else {
	add_post_meta($post_id, 'previews', 0, true);
}
$downloads = get_post_meta($post_id, 'downloads', true);
if ($downloads != '') {
	$downloads = (int) $downloads;
} else {
	add_post_meta($post_id, 'downloads', 0, true);
}

$installs = get_post_meta($post_id, 'installs', true);
if ($installs != '') {
	$installs = (int) $installs;
} else {
	add_post_meta($post_id, 'downloads', 0, true);
}

?>
<h3>By: <?php the_author_link(); ?></h3>
<p id="author-bio"><?php the_author_meta('description'); ?></p>
<div id="author-porfolio">
<a id="author-image" href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php echo get_avatar( get_the_author_meta('user_email'), '30', '' ); ?></a>
<!-- <span class="rank">Talent 0/10</span> -->
<a class="btn-org" href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>">View porfolio</a></div>
<!--Author Info--><div class="space"></div>

<h3>Status</h3>
<?php if ($previews != '' && $previews != 0) :?><span class="stat">Previews: <strong><?php echo $previews;?></strong></span><?php endif;?>
<?php if ($downloads != '' && $downloads != 0) :?><span class="stat">Downloads: <strong><?php echo $downloads;?></strong></span><?php endif;?>
<?php if ($installs != '' && $installs != 0) :?><span class="stat">Installs: <strong><?php echo $installs;?></strong></span><?php endif;?>
<span class="stat">Views: <strong><?php echo $views; ?></strong></span>
<span class="stat">Rate up: <strong class="rate-up rate-val">+<?php echo $rate_up; ?></strong><span data="<?php echo $post_id;?>" class="rate plus">+</span></span>
<span class="stat">Rate down: <strong class="rate-down rate-val">-<?php echo $rate_down; ?></strong><span data="<?php echo $post_id;?>" class="rate minus">-</span></span>
<!--Status--><div class="space"></div>

<h3>Share</h3>
<div class="share">
	<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_counter_style" style="left:50px;top:50px;">
<a class="addthis_button_facebook_like" fb:like:layout="box_count"></a>
<a class="addthis_button_tweet" tw:count="vertical"></a>
<a class="addthis_button_google_plusone" g:plusone:size="tall"></a>
<a class="addthis_counter"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":false};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4f98ab455ea4fbd4"></script>
<!-- AddThis Button END -->
</div>
<!--Share-->